package com.yilin.tms.core.entity.capital;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yilin.tms.core.commons.base.BaseDataEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * 某一用户拥有的优惠劵
 * */
@Entity
@Table(name = "capital_coupon_card")
@TableName(value = "capital_coupon_card")
public class CouponCard extends BaseDataEntity {

    public enum CouponType {
        none(0, "未知"),
        reduction(1, "减免券"),
        redPacket(2, "红包券"),
        service(3, "服务券");
        @EnumValue
        public Integer index;
        public String name;
        CouponType(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    @Column(name = "organize_id")
    private String organizeId;//所属组织
    @Column(name = "organize_name")
    private String organizeName;//所属组织

    @Column(name = "coupon_code")
    private String couponCode;//券码（同一类券相同，类型、标题、描述相同）
    @Column(name = "coupon_type")
    private CouponType couponType;
    @Column(name = "title")
    private String title;//标题
    @Column(name = "use_describe")
    private String useDescribe;//描述

    @Column(name = "threshold")
    private Double threshold;//阈值 减免券 与 面值合并为 “满XX元减免XX元，0”
    @Column(name = "par_value")
    private Double parValue;//面值 红包券/减免券
    @Column(name = "par_unit")
    private String parUnit;//面值单位

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "expiry_date")
    private Date expiryDate;//有效期
    @Column(name = "fold_count")
    private Integer foldCount;//折叠数量（券码相同时，新增券只叠加数量）

    public CouponType getCouponType() {
        return couponType;
    }

    public void setCouponType(CouponType couponType) {
        this.couponType = couponType;
    }

    public String getCouponCode() {
        return couponCode;
    }

    public void setCouponCode(String couponCode) {
        this.couponCode = couponCode;
    }

    public Integer getFoldCount() {
        return foldCount;
    }

    public void setFoldCount(Integer foldCount) {
        this.foldCount = foldCount;
    }

    public Date getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(Date expiryDate) {
        this.expiryDate = expiryDate;
    }

    public String getParUnit() {
        return parUnit;
    }

    public void setParUnit(String parUnit) {
        this.parUnit = parUnit;
    }

    public String getOrganizeId() {
        return organizeId;
    }

    public void setOrganizeId(String organizeId) {
        this.organizeId = organizeId;
    }

    public String getOrganizeName() {
        return organizeName;
    }

    public void setOrganizeName(String organizeName) {
        this.organizeName = organizeName;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUseDescribe() {
        return useDescribe;
    }

    public void setUseDescribe(String useDescribe) {
        this.useDescribe = useDescribe;
    }

    public Double getThreshold() {
        return threshold;
    }

    public void setThreshold(Double threshold) {
        this.threshold = threshold;
    }

    public Double getParValue() {
        return parValue;
    }

    public void setParValue(Double parValue) {
        this.parValue = parValue;
    }
}
